package org.rsbot.script.randoms;

import org.rsbot.script.Random;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.methods.Interfaces;
import org.rsbot.script.wrappers.RSComponent;

@ScriptManifest(name="LeaveSafeArea", authors={"Taha"}, version=1.0D)
public class LeaveSafeArea extends Random
{
  public boolean activateCondition()
  {
    return ((this.interfaces.getComponent(212, 2).containsText("things can get more")) && (this.interfaces.getComponent(212, 2).getAbsoluteY() > 380) && (this.interfaces.getComponent(212, 2).getAbsoluteY() < 410)) || ((this.interfaces.getComponent(236, 1).containsText("the starting area")) && (this.interfaces.getComponent(236, 1).getAbsoluteY() > 390) && (this.interfaces.getComponent(236, 1).getAbsoluteY() < 415));
  }

  public int loop()
  {
    if (this.interfaces.canContinue()) {
      this.interfaces.clickContinue();
      sleep(random(1000, 1200));
    }
    this.interfaces.getComponent(236, 1).doClick();
    return -1;
  }
}